import pandas as pd
from data_resource.data_bases import engine
from factorAnaly.factorEngine import factor_return


def factor_return_returnWgt():
    """计算因子收益率"""
    sql = """
    select trading as trade_date, code, signal, pct_chg/100 as daily_return
    from quant_research."factor_returnWgt"
    where trading >= '2016-01-01'
    order by trading
    """

    _raw = pd.read_sql(sql, engine)

    _x = factor_return(_raw)

    return _x
